home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
nroff~06.zoo
/
dev.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-16
|
14KB
|
330 lines
static char *rcsid_dev_c="$Id: dev.c,v 1.2 1992/07/16 10:38:32 rosenkra Exp $";
/*
* $Log: dev.c,v $
* Revision 1.2 1992/07/16 10:38:32 rosenkra
* port to gcc, add tm,ie,el
*
*/
/*
* dev.c - handle special output devices.
*
* adapted for atariST/TOS by Bill Rosenkranz 11/89
* net: rosenkra@convex.com
* CIS: 71460,17
* GENIE: W.ROSENKRANZ
*
*/
#undef NRO_MAIN /* extern globals */
#include <stdio.h>
#include "nroff.h"
/*------------------------------*/
/* dev_char */
/*------------------------------*/
int dev_char (c1, c2, c) /* returns num chars */
REGISTER char c1; /* first char in escape */
REGISTER char c2; /* second char in escape */
REGISTER char *c; /* ascii char to return */
{
/*
* handle specific output devices.
*
* this will eventually read \lib\term\tab* files, but for now, we just
* use our ANSI/vt100 scheme. in future, main will call something to
* read -Tname (tabname) file, which would initialize a table of c1c2
* vs ascii char. this routine would then read that table and presumably
* return a string rather than a single char.
*/
/*
* special symbols
*/
if (c1 == 'e' && c2 == 'm') {*c = '-'; return (2);} /* long dash */
if (c1 == 'h' && c2 == 'y') {*c = ','; return (2);} /* hyphen */
if (c1 == 'b' && c2 == 'u') {*c = '*'; return (2);} /* bullet */
if (c1 == 's' && c2 == 'q') {*c = 0xef; return (2);} /* square */
if (c1 == 'r' && c2 == 'u') {*c = '_'; return (2);} /* rule */
if (c1 == 'u' && c2 == 'l') {*c = '^'; return (2);} /* underrule */
if (c1 == 'o' && c2 == 'l') {*c = ';'; return (2);} /* overrule */
if (c1 == 'r' && c2 == '2') {*c = 0x3f; return (2);} /* thin rule */
if (c1 == 'u' && c2 == '2') {*c = 0x9d; return (2);} /* thin underrule */
if (c1 == 'o' && c2 == '2') {*c = 0x40; return (2);} /* thin overrule */
if (c1 == '1' && c2 == '4') {*c = 0xac; return (2);} /* 1/4 */
if (c1 == '1' && c2 == '2') {*c = 0xab; return (2);} /* 1/2 */
if (c1 == '3' && c2 == '4') {*c = 0xad; return (2);} /* 3/4 */
if (c1 == 'd' && c2 == 'e') {*c = 0xf8; return (2);} /* degree */
if (c1 == 'd' && c2 == 'g') {*c = 0xbb; return (2);} /* dagger */
if (c1 == 'c' && c2 == 't') {*c = '$'; return (2);} /* cent */
if (c1 == 'r' && c2 == 'g') {*c = 0xbe; return (2);} /* registered */
if (c1 == 'c' && c2 == 'o') {*c = 0xbd; return (2);} /* copyrite */
if (c1 == 't' && c2 == 'm') {*c = 0xbf; return (2);} /* tm */
if (c1 == 's' && c2 == 'c') {*c = 0xdd; return (2);} /* section */
if (c1 == 'a' && c2 == 'a') {*c = 0x27; return (2);} /* acute */
if (c1 == 'g' && c2 == 'a') {*c = 0x60; return (2);} /* grave */
if (c1 == 's' && c2 == 'l') {*c = '/'; return (2);} /* slash */
if (c1 == '.' && c2 == '.') {*c = ':'; return (2);} /* elipsis */
if (c1 == 'P' && c2 == 'P') {*c = 0xbc; return (2);} /* para */
if (c1 == 'o' && c2 == 'q') {*c = '!'; return (2);} /* open " */
if (c1 == 'c' && c2 == 'q') {*c = '\"'; return (2);} /* close " */
if (c1 == 'd' && c2 == 'd') {*c = 0xba; return (2);} /* dbl dagger */
/*
* greek
*/
if (c1 == '*' && c2 >= 'a' && c2 <= 'z')
{
/*
* lower case
*/
if (c2 == 'a') {*c = 'a'; return (2);} /* alpha */
if (c2 == 'b') {*c = 'b'; return (2);} /* beta */
if (c2 == 'g') {*c = 'g'; return (2);} /* gamma */
if (c2 == 'd') {*c = 'd'; return (2);} /* delta */
if (c2 == 'e') {*c = 'e'; return (2);} /* epsilon */
if (c2 == 'z') {*c = 'z'; return (2);} /* zeta */
if (c2 == 'y') {*c = 'y'; return (2);} /* eta */
if (c2 == 'h') {*c = 'h'; return (2);} /* theta */
if (c2 == 'i') {*c = 'i'; return (2);} /* iota */
if (c2 == 'k') {*c = 'k'; return (2);} /* kappa */
if (c2 == 'l') {*c = 'l'; return (2);} /* lambda */
if (c2 == 'm') {*c = 'm'; return (2);} /* mu */
if (c2 == 'n') {*c = 'n'; return (2);} /* nu */
if (c2 == 'c') {*c = 'c'; return (2);} /* xi */
if (c2 == 'o') {*c = 'o'; return (2);} /* omicron */
if (c2 == 'p') {*c = 'p'; return (2);} /* pi */
if (c2 == 'r') {*c = 'r'; return (2);} /* rho */
if (c2 == 's') {*c = 's'; return (2);} /* sigma */
if (c2 == 't') {*c = 't'; return (2);} /* tau */
if (c2 == 'u') {*c = 'u'; return (2);} /* upsilon */
if (c2 == 'f') {*c = 'f'; return (2);} /* phi */
if (c2 == 'x') {*c = 'x'; return (2);} /* chi */
if (c2 == 'q') {*c = 'q'; return (2);} /* psi */
if (c2 == 'w') {*c = 'w'; return (2);} /* omega */
}
if (c1 == '*' && c2 >= 'A' && c2 <= 'Z')
{
/*
* upper case
*/
if (c2 == 'A') {*c = 'A'; return (2);} /* Alpha */
if (c2 == 'B') {*c = 'B'; return (2);} /* Beta */
if (c2 == 'G') {*c = 'G'; return (2);} /* Gamma */
if (c2 == 'D') {*c = 'D'; return (2);} /* Delta */
if (c2 == 'E') {*c = 'E'; return (2);} /* Epsilon */
if (c2 == 'Z') {*c = 'Z'; return (2);} /* Zeta */
if (c2 == 'Y') {*c = 'Y'; return (2);} /* Eta */
if (c2 == 'H') {*c = 'H'; return (2);} /* Theta */
if (c2 == 'I') {*c = 'I'; return (2);} /* Iota */
if (c2 == 'K') {*c = 'K'; return (2);} /* Kappa */
if (c2 == 'L') {*c = 'L'; return (2);} /* Lambda */
if (c2 == 'M') {*c = 'M'; return (2);} /* Mu */
if (c2 == 'N') {*c = 'N'; return (2);} /* Nu */
if (c2 == 'C') {*c = 'C'; return (2);} /* Xi */
if (c2 == 'O') {*c = 'O'; return (2);} /* Omicron */
if (c2 == 'P') {*c = 'P'; return (2);} /* Pi */
if (c2 == 'R') {*c = 'R'; return (2);} /* Rho */
if (c2 == 'S') {*c = 'S'; return (2);} /* Sigma */
if (c2 == 'T') {*c = 'T'; return (2);} /* Tau */
if (c2 == 'U') {*c = 'U'; return (2);} /* Upsilon */
if (c2 == 'F') {*c = 'F'; return (2);} /* Phi */
if (c2 == 'X') {*c = 'X'; return (2);} /* Chi */
if (c2 == 'Q') {*c = 'Q'; return (2);} /* Psi */
if (c2 == 'W') {*c = 'W'; return (2);} /* Omega */
}
/*
* box chars
*/
if (c1 == 'L' && c2 >= 'a' && c2 <= 'k')
{
/*
* single line
*/
if (c2 == 'a') {*c = 0xd0; return (2);} /**/
if (c2 == 'b') {*c = 0xd1; return (2);} /**/
if (c2 == 'c') {*c = 0xd2; return (2);} /**/
if (c2 == 'd') {*c = 0xd3; return (2);} /**/
if (c2 == 'e') {*c = 0xd4; return (2);} /**/
if (c2 == 'f') {*c = 0xd5; return (2);} /**/
if (c2 == 'g') {*c = 0xd6; return (2);} /**/
if (c2 == 'h') {*c = 0xd7; return (2);} /**/
if (c2 == 'i') {*c = 0xd8; return (2);} /**/
if (c2 == 'j') {*c = 0xd9; return (2);} /**/
if (c2 == 'k') {*c = 0xda; return (2);} /**/
}
if (c1 == 'L' && c2 >= 'A' && c2 <= 'Q')
{
/*
* double line
*/
if (c2 == 'A') {*c = 0xc0; return (2);} /**/
if (c2 == 'B') {*c = 0xc1; return (2);} /**/
if (c2 == 'C') {*c = 0xc2; return (2);} /**/
if (c2 == 'D') {*c = 0xc3; return (2);} /**/
if (c2 == 'E') {*c = 0xc4; return (2);} /**/
if (c2 == 'F') {*c = 0xc5; return (2);} /**/
if (c2 == 'G') {*c = 0xc6; return (2);} /**/
if (c2 == 'H') {*c = 0xc7; return (2);} /**/
if (c2 == 'I') {*c = 0xc8; return (2);} /**/
if (c2 == 'J') {*c = 0xc9; return (2);} /**/
if (c2 == 'K') {*c = 0xca; return (2);} /**/
if (c2 == 'L') {*c = 0xcb; return (2);} /**/
if (c2 == 'M') {*c = 0xcc; return (2);} /**/
if (c2 == 'N') {*c = 0xcd; return (2);} /**/
if (c2 == 'O') {*c = 0xce; return (2);} /**/
if (c2 == 'P') {*c = 0xcf; return (2);} /**/
if (c2 == 'Q') {*c = 0x80; return (2);} /**/
}
/*
* number super/subscripts
*/
if (c1 == 'b' && c2 >= '0' && c2 <= '9')
{
if (c2 == '0') {*c = 0xa0; return (2);} /* sub 0 */
if (c2 == '1') {*c = 0xa1; return (2);} /* sub 1 */
if (c2 == '2') {*c = 0xa2; return (2);} /* sub 2 */
if (c2 == '3') {*c = 0xa3; return (2);} /* sub 3 */
if (c2 == '4') {*c = 0xa4; return (2);} /* sub 4 */
if (c2 == '5') {*c = 0xa5; return (2);} /* sub 5 */
if (c2 == '6') {*c = 0xa6; return (2);} /* sub 6 */
if (c2 == '7') {*c = 0xa7; return (2);} /* sub 7 */
if (c2 == '8') {*c = 0xa8; return (2);} /* sub 8 */
if (c2 == '9') {*c = 0xa9; return (2);} /* sub 9 */
}
if (c1 == 'p' && c2 >= '0' && c2 <= '9')
{
if (c2 == '0') {*c = 0x30; return (2);} /* super 0 */
if (c2 == '1') {*c = 0x31; return (2);} /* super 1 */